package com.example.demo.serviceipml;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.dao.UserRoleDao;
import com.example.demo.entify.Menu;
import com.example.demo.entify.Role;
import com.example.demo.entify.User;
import com.example.demo.entify.UserRole;
import com.example.demo.service.UserRoleService;

@Service("UserRoleService")
public class UserRoleServiceIpml implements UserRoleService {
	@Autowired
	private UserRoleDao userRoleDao;


	@Override
	public boolean saveUserRole(UserRole user) {
		// TODO Auto-generated method stub
			int i = userRoleDao.saveUserRole(user);
			if(i>1) {
				
				return true;
				
			}
			return false;
	}

	@Override
	public User findRoleByname(String username) {
		// TODO Auto-generated method stub
		return userRoleDao.findRoleByname(username);
	}

	@Override
	public List<Role> findMenuByname(int id) {
		// TODO Auto-generated method stub
		return userRoleDao.findMenuByname(id);
	}
	
	
}
